<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wemoney - Dashboard</title>
    <!-- font awesome icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"
        integrity="sha512-KfkfwYDsLkIlwQp6LFnl8zNdLGxu9YAA1QvwINks4PhcElQSvqcyVLLD9aMhXd13uQjoXtEKNosOWaZqXgel0g=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="{{ url_for('static', filename='font/bootstrap-icons.css') }}">
    <!-- bootstrap -->
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap-5.1.3-dist/css/bootstrap.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">

    <style>
        th{
            vertical-align: middle;
            text-align: center;
        }

        tr th:first-child {
             width: 20px;
        }
        .form-check{
            width: 20px;
        }
    </style>
</head>

<body>
    <div class="dashboard-pg text-grey-blue">
        <nav class="navigation-bar d-flex align-items-center">
            <div class="container">
                <div class="row align-items-center">
                    <div class="navigation-bar-left col-4 d-flex align-items-center">
                        <button type="button" class="navbar-open-btn text-grey-blue me-3">
                            <i class="bi bi-list h3"></i>
                        </button>
                        <!-- <div class="navbar-logo">
                            <img src="assets/images/logo.png" alt="site logo">
                        </div> -->
                    </div>
                    <div class="col-4 h3 text-center ">图书管理系统</div>
                    <div class="navigation-bar-right col-4 d-flex align-items-center justify-content-end">
                        <span class="col-2">{{session['nick_name']}}</span>
                        <a href="{{ url_for('admin.center') }}" id="user" class="profile-btn bg-blue text-white btn-circle ms-1">
                            <i class="bi bi-person-fill fs-20"></i>
                        </a>
                        <!-- <button type="button" class="notification-btn text-grey-blue">
                            <i class="fa-regular fa-bell"></i>
                        </button> -->
                    </div>
                </div>
            </div>
        </nav>

        <div class="navigation-overlay position-fixed"></div>

        <div class="navigation-sidebar bg-light-grey">
            <div class="navbar-sb-head d-flex justify-content-between align-items-center px-4">
                <!-- <img src="assets/images/logo.png"> -->
                <span>{{session['nick_name']}}</span>
                <button class="navbar-close-btn text-grey-blue">
                    <i class="bi bi-arrow-left"></i>
                </button>
            </div>

            <div class="navbar-sb-list p-4">
                <div class="navbar-sb-item mb-5">
                    <h5 class="text-uppercase text-grey navbar-sb-item-title fs-12 ls-1">功能区</h5>
                    <ul class="navbar-sb-links p-0 list-unstyled">
                        <li class="navbar-sb-link my-3">
                            <a href="{{ url_for('book_manage.books_getall') }}" class="text-decoration-none d-flex align-items-center justify-content-between">
                                <div class="text-light-blue d-flex align-items-center">
                                    <span class="navbar-sb-icon me-3">
                                        <i class="bi bi-book"></i>
                                    </span>
                                    <span class="navbar-sb-text fs-14 fw-5 text-capitalize">图书管理</span>
                                </div>
                                <!-- <span class="badge text-uppercase text-blue">hot</span> -->
                            </a>
                        </li>

                        <li class="navbar-sb-link my-3">
                            <a href="{{ url_for('admin.borrow') }}" class="text-decoration-none d-flex align-items-center justify-content-between">
                                <div class="text-light-blue d-flex align-items-center">
                                    <span class="navbar-sb-icon me-3">
                                        <i class="bi bi-list-ul"></i>
                                    </span>
                                    <span class="navbar-sb-text fs-14 fw-5 text-capitalize">借阅管理</span>
                                </div>
                                <!-- <span class="badge text-uppercase text-blue">new</span> -->
                            </a>
                        </li>

                        <li class="navbar-sb-link my-3">
                            <a href="{{ url_for('admin.usr') }}" class="text-decoration-none d-flex align-items-center justify-content-between">
                                <div class="text-light-blue d-flex align-items-center">
                                    <span class="navbar-sb-icon me-3">
                                        <i class="bi bi-people"></i>
                                    </span>
                                    <span class="navbar-sb-text fs-14 fw-5 text-capitalize">用户管理</span>
                                </div>
                                <!-- <span class="badge text-uppercase text-blue">new</span> -->
                            </a>
                        </li>

                        <li class="navbar-sb-link my-3">
                            <a href="{{ url_for('admin.center') }}" class="text-decoration-none d-flex align-items-center justify-content-between">
                                <div class="text-light-blue d-flex align-items-center">
                                    <span class="navbar-sb-icon me-3">
                                        <i class="bi bi-person"></i>
                                    </span>
                                    <span class="navbar-sb-text fs-14 fw-5 text-capitalize">个人中心</span>
                                </div>
                                <!-- <span class="badge text-uppercase text-blue">new</span> -->
                            </a>
                        </li>
                    </ul>
                </div>



                

                <div class="navbar-sb-item mb-5">
                    <h5 class="text-uppercase text-grey navbar-sb-item-title fs-12 ls-1">用户操作</h5>
                    <ul class="navbar-sb-links p-0 list-unstyled">
                        <li class="navbar-sb-link my-3">
                            <a href="#" class="text-decoration-none d-flex align-items-center justify-content-between">
                                <div class="text-light-blue d-flex align-items-center">
                                    <span class="navbar-sb-icon me-3">
                                        <i class="fas fa-lock"></i>
                                    </span>
                                    <span class="navbar-sb-text fs-14 fw-5 text-capitalize"><a href="{{url_for('auth.logout')}}" style="display:block;width:100%;height:100%;text-decoration:none;">logout</a></span>
                                </div>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
       
          
        <!-- 主页面 -->
        <div class="dashboard-main">
            <div class="container">
                <div class="row pt-3">
                    <div class="col-12">
                        <h4 class="col-12 bg-light-grey py-2">借阅记录</h4>
                    </div>
                </div>
                <form action="{{ url_for('admin.search_borrow') }}" method="post">
                    <div class="row mb-3 ">
                        <div class="col-2">
                            <input type="text" class="form-control col-3" name="usrname" id="usrname"
                                placeholder="请输入用户名" value="{{session['borrow_search']}}">
                        </div>
                        <div class="col-4">
                            <button class="btn btn-primary mr-2"><i class="bi bi-search"></i>查询</button>
                            <a href="{{ url_for('admin.borrow') }}">
                            <button type="button" class="btn btn-danger"><i class="bi bi-x"></i>清除</button>
                            </a>
                        </div>
                    </div>
                </form>

                <form action="">
                    <div class=" border" style="height: 600px;">

                        <table class="table table-striped justify-content-center align-items-center table-hover table-bordered"
                            style="text-align: center;">
                            <thead>
                                <tr >
                                    <th>
                                        <div class="form-check">
                                            <input class="form-check-input" type="checkbox" value="" id="full">
                                        </div>
                                    </th>
                                    <th>用户名</th>
                                    <th>书籍ISBN号</th>
                                    <th>借阅时间</th>
                                    <th>状态</th>
                                </tr>
                            </thead>
                            <tbody>
                            {% for b in borrowlist: %}
                                <tr>
                                    <th>
                                        <div class="form-check ">
                                            <input class="form-check-input " type="checkbox" value="" id="full">
                                        </div>
                                    </th>
                                    <th>{{b.user_name}}</th>
                                    <th>{{b.book_isbn}}</th>
                                    <th>{{b.borrowtime}}</th>
                                    {% if b.isback == 0:%}
                                        {% if (b.borrowtime - now).seconds > 432000: %}
                                        <th style="color:red;">超时</th>
                                        {% else: %}
                                        <th>借阅中</th>
                                        {% endif %}
                                    {% else: %}
                                    <th style="color:green;">已归还</th>
                                    {% endif %}
                                </tr>
                            {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </form>

                <!-- 记录修改 -->
                <form action="" method="post">
                    <div class="modal fade" id="editlog" tabindex="-1" aria-labelledby="a" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title" id="a">用户信息修改</h5>
                                    <button type="button" class="btn-close" data-bs-dismiss="modal"
                                        aria-label="Close"></button>
                                </div>
                                <div class="modal-body">
                                    <div class="mb-3">
                                        <label for="username" class="form-label">用户名</label>
                                        <input type="text" class="form-control" id="username" placeholder="请输入用户名">
                                    </div>
                                    <div class="mb-3">
                                        <label for="ISBN" class="form-label">书籍ISBN号</label>
                                        <input type="text" class="form-control" id="ISBN" placeholder="请输入ISBN号">
                                    </div>
                                    <div class="mb-3">
                                        <label for="time" class="form-label">借阅时间</label>
                                        <input type="datetime-local" class="form-control" id="time" placeholder="请输入电话">
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                                    <button type="submit" class="btn btn-primary">修改</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>

                <!-- 修改结束 -->

                <!-- 记录删除 -->
                <div class="modal fade" id="deletelog" tabindex="-1" aria-labelledby="exampleModalLabel"
                    aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel">即将删除该记录</h5>
                                <button type="button" class="btn-close" data-bs-dismiss="modal"
                                    aria-label="Close"></button>
                            </div>
                            <div class="modal-body">
                                请确认是否删除该记录
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                                <button type="submit" class="btn btn-danger">删除</button>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 删除结束 -->

                <form action="{{ url_for('admin.borrow_jump')}}" method="post">
                    <div class="container mt-3 align-items-center"  >
                        <div class="row ">
                            <div class="col-4" style="padding-top: 8px;"> 显示第{{ (nowpage-1)*10+1 }}条到第{{nowpage*10}}条记录，总共<b>{{ session['borrowsum'] }}</b>条记录&nbsp;</div>
                            <ul class="pagination col-5  justify-content-end">
                                {% if nowpage ==  1: %}
                                <li class="page-item disabled"><a class="page-link" href="{{url_for('admin.borrow_turn',page=nowpage-1)}}"><i class="bi bi-chevron-left"></i></a></li>
                                {% else: %}
                                <li class="page-item"><a class="page-link" href="{{url_for('admin.borrow_turn',page=nowpage-1)}}"><i class="bi bi-chevron-left"></i></a></li>
                                {% endif %}
                                {% for page in range(1, session['borrowpages']+1): %}
                                <li class="page-item"><a class="page-link" href="{{url_for('admin.borrow_turn',page=page)}}">{{ page }}</a></li>
                                {% endfor %}
                                {% if nowpage ==  session['borrowpages']: %}
                                <li class="page-item disabled" ><a class="page-link" href="{{url_for('admin.borrow_turn',page=nowpage+1)}}"><i class="bi bi-chevron-right"></i></a></li>
                                {% else: %}
                                <li class="page-item" ><a class="page-link" href="{{url_for('admin.borrow_turn',page=nowpage+1)}}"><i class="bi bi-chevron-right"></i></a></li>
                                {% endif %}
                            </ul>
                            <div class="col-3">
                                <div class="input-group">
                                    <span style="padding-top: 8px;" >跳转到</span>
                                    <input type="number"  class="form-control" max="{{ session['borrowpages'] }}" min="1" name="page" id="page" value=1>
                                    <span style="padding-top: 8px;">页</span>
                                    <button class="btn btn-primary ms-1">确定</button>
                                </div>
                             </div>

                        </div>

                    </div>
                </form>



            </div>
        </div>
    </div>

    <!-- jquery -->

    <script src="{{ url_for('static', filename='js/jQuery.js') }}"></script>
    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
    <script src="{{ url_for('static', filename='bootstrap-5.1.3-dist/js/bootstrap.js') }}"></script>

</body>

</html>